package com.nbsaas.boot.student.rest.resource;

import com.nbsaas.boot.rest.request.PageRequest;
import com.nbsaas.boot.rest.response.ListResponse;
import com.nbsaas.boot.student.api.apis.StudentApi;
import com.nbsaas.boot.student.data.entity.Student;
import com.nbsaas.boot.student.api.domain.request.StudentDataRequest;
import com.nbsaas.boot.student.api.domain.request.StudentSearchRequest;
import com.nbsaas.boot.student.api.domain.response.StudentResponse;
import com.nbsaas.boot.student.api.domain.simple.StudentSimple;
import com.nbsaas.boot.student.rest.convert.StudentSimpleConvert;
import com.nbsaas.boot.student.rest.convert.StudentEntityConvert;
import com.nbsaas.boot.student.rest.convert.StudentResponseConvert;
import com.nbsaas.boot.student.data.repository.StudentRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import javax.annotation.Resource;
import java.util.Collection;
import java.util.List;
import java.util.function.Function;

/**
*   业务接口实现
*/
@Transactional
@Service
public class StudentResource extends BaseResource<Student,StudentResponse, StudentSimple, StudentDataRequest>  implements StudentApi {

    @Resource
    private StudentRepository studentRepository;

    @Override
    public JpaRepositoryImplementation<Student, Serializable> getJpaRepository() {
        return studentRepository;
    }

    @Override
    public Function<Student, StudentSimple> getConvertSimple() {
        return new StudentSimpleConvert();
    }

    @Override
    public Function<StudentDataRequest, Student> getConvertForm() {
        return new StudentEntityConvert();
    }

    @Override
    public Function<Student, StudentResponse> getConvertResponse() {
    return new StudentResponseConvert();
    }




}


